import 'package:car_baidu/core/constant/initialize_data.dart';
import 'package:car_baidu/ui/page/login/login.dart';
import 'package:car_baidu/ui/page/main/main.dart';
import 'package:car_baidu/ui/page/mine/modify_password/modify_password.dart';
import 'package:car_baidu/ui/page/mine/setting/setting.dart';
import 'package:car_baidu/ui/widget/web_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class LLRouter {
  // 1. 获取initialize配置信息.
  static String initialRouter = LLMainScreen.routeName;

  static initialize() {
    bool isLogin = LLInitializeData.isLogin;
    print("isLogin: $isLogin");
    if (isLogin) {
      initialRouter = LLMainScreen.routeName;
    } else {
      initialRouter = LLLoginScreen.routeName;
    }
  }

  static final Map<String, WidgetBuilder> routers = {
    LLMainScreen.routeName: (ctx) => LLMainScreen(),
    LLLoginScreen.routeName: (ctx) => LLLoginScreen(),
    LLWebViewScreen.routeName: (ctx) => LLWebViewScreen(),
    LLSettingScreen.routeName: (ctx) => LLSettingScreen(),
    LLModifyPasswordScreen.routeName: (ctx) => LLModifyPasswordScreen(),
  };

  static RouteFactory onGenerateRoute = (RouteSettings settings) {
    return null;
  };
  static RouteFactory onUnknownRoute = (RouteSettings settings) {
    return null;
  };
}
